package com.ys.vo;

import java.util.HashMap;

public class A extends HashMap<String, Object> {
    
	private static final long serialVersionUID = 1L;
	
	public static int SUCCESS_CODE = 200;
    public static int ERROR_CODE = 422;
    public static int RELOGIN_CODE = 402;
    
    public int getStatus() {
    	return Integer.parseInt(this.get("code").toString());
    }
    
    public String getMessage() {
    	return this.get("msg").toString();
    }
	
	public static A err(String msg) {
		A r = new A();
        r.put("code", ERROR_CODE);
        r.put("msg", msg);
        return r;
	}
    
    public static A errLogin(String msg) {
    	A r = new A();
        r.put("code", RELOGIN_CODE);
        r.put("msg", msg);
        return r;
    }
	
	public static A suc(String msg) {
		A r = new A();
        r.put("code", SUCCESS_CODE);
        r.put("msg", msg);
        return r;
	}
	
	public static A suc(Object data) {
		A r = new A();
        r.put("code", SUCCESS_CODE);
        r.put("data", data);
        return r;
	}
}
